import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import axios from 'axios'
import Vuex from 'vuex' //引入状态管理
import GoEasy from 'goeasy';

Vue.prototype.$axios = axios;
Vue.use(Vuex) ;

Vue.config.productionTip = false



// 添加请求拦截器，在请求头中加token
axios.interceptors.request.use(
  config => {
    if (localStorage.getItem('token')) {
      config.headers.token = localStorage.getItem('token');
    }

    return config;
  },
  error => {
    return Promise.reject(error);
  });


// 建议在main.js里初始化全局的GoEasy对象
Vue.prototype.goEasy = GoEasy.getInstance({
  host:'hangzhou.goeasy.io', //应用所在的区域地址: 【hangzhou.goeasy.io |singapore.goeasy.io】
  appkey: "BC-f92a140e428c4ce79442bafc26e543d8" //替换为您的应用appkey
});


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
